package ren.kane.phoenix.util.schedule;

import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author renrk(1275) on 2018-11-05 10:37 AM
 **/
@Component
public class SchedulerTask {

    private int count = 0;

    private SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss");

    @Scheduled(cron = "0 0/10 * * * ?")
    private void process() {
        System.out.println("process: " + simpleDateFormat.format(new Date()) + " , " + (count++));
    }

    @Scheduled(initialDelay = 30000, fixedRate = 50000)
    private void report() {
        System.out.println("report: " + simpleDateFormat.format(new Date()));
    }
}
